package com.ays.service;

import com.ays.bean.AtmSyncLog;
import com.ays.mapper.AtmSyncLogMapper;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.scheduling.annotation.Async;
import org.springframework.stereotype.Service;

import java.text.SimpleDateFormat;
import java.util.Date;

/**
 * @author Administrator
 * @date 2024/6/5
 * @desc
 */
@Service
public class SyncLogService {
    @Autowired
    private AtmSyncLogMapper atmSyncLogMapper;

    @Async
    public void insertLog(String module, String content,String params,String status,String message){
        AtmSyncLog log = new AtmSyncLog();
        Date date = new Date();
        SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
        log.setLogId(module+date.getTime());
        log.setContent(content);
        log.setModule(module);
        log.setParam(params);
        log.setCreatedTime(sdf.format(date));
        log.setStatus(status);
        log.setMessage(message);
        atmSyncLogMapper.insert(log);
    }
}
